#include <iostream>
using namespace std;
int main()
{
	int n=0;
	int i=1; 
	int a,b,c;
	int p1,p2,p3;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a>>b>>c;
		p1+=a;
		p2+=b;
		p3+=c;
	}
	int sum=p1+p2+p3;
	cout<<p1<<" "<<p2<<" "<<p3<<" "<<sum;
	
	
	
	
	return 0;
}
